const MyPromise = require('./MyPromise');

function p1 () {
    return new MyPromise(function (resolve, reject) {
      setTimeout(function () {
        resolve('p1')
      }, 2000)
    })
  }
  function p2 () {
    return new MyPromise(function (resolve, reject) {
     // reject('失败')
       resolve('成功');    
    })
  }
   
  p2()
    .then(value => console.log(value))
    .catch(reason => console.log(reason))